package com.design.pattern.command.projection3;

import java.util.List;

/**
 * 命令发送者
 */
public class ConcreteCommandSender implements CommandSender {
    private CommandChannel channel;
    private List<CommandExecutor> executors;
    public ConcreteCommandSender(CommandChannel channel,List<CommandExecutor> executors) {
        this.channel = channel;
        this.executors=executors;
    }

    @Override
    public void send(Command command) {
        for (CommandExecutor executor:executors){
            channel.spreadTheOrder(command,executor);
        }
    }
}
